
//使用AJAX获取数据,返回json数据
function getData(url) {
    $.ajax({
        url:"http://192.168.15.106" + url,
        dataType:"json",
        success:function (data) {
            bindDetail(data);
        },
        error:function () {
            alert("error");
            return null;
        }
    })
}

//绑定数据
function bindDetail(data) {
    $(".image img").attr("src",data.images);
    $(".movie-title").text(data.title);
    $(".movie-summary").text(data.summary);
    $(".watch").attr("href","vedio.html?id=" + data.id+"videoNum=0");
}

function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}

$(function () {
    var id = getUrlParam("id");
    // var name = getUrlParam("name");
    getData("/api/searchid?id=" + id);
});
